<template>
  <div id="swiper">
    <div class="tequan">
      <h1>
        <span>特权2</span>会员红包可升级大额商家红包
      </h1>
    </div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item>
        <div class="swipertext" v-for="item in wow_swiper">
          <div class="swiperimg">
            <img :src="item.image_url" alt />
          </div>
          <p>{{ item.name }}</p>
          <h3>
            ￥{{ item.reduce_amount }}
            <span>无门槛</span>
          </h3>
        </div>
      </van-swipe-item>
      <van-swipe-item>
        <div class="swipertext" v-for="item in wow_swiper">
          <div class="swiperimg">
            <img :src="item.image_url" alt />
          </div>
          <p>{{ item.name }}</p>
          <h3>
            ￥{{ item.reduce_amount }}
            <span>无门槛</span>
          </h3>
        </div>
      </van-swipe-item>
      <van-swipe-item>
        <div class="swipertext" v-for="item in wow_swiper">
          <div class="swiperimg">
            <img :src="item.image_url" alt />
          </div>
          <p>{{ item.name }}</p>
          <h3>
            ￥{{ item.reduce_amount }}
            <span>无门槛</span>
          </h3>
        </div>
      </van-swipe-item>
      <van-swipe-item>
        <div class="swipertext" v-for="item in wow_swiper">
          <div class="swiperimg">
            <img :src="item.image_url" alt />
          </div>
          <p>{{ item.name }}</p>
          <h3>
            ￥{{ item.reduce_amount }}
            <span>无门槛</span>
          </h3>
        </div>
      </van-swipe-item>
      <van-swipe-item>
        <div class="swipertext" v-for="item in wow_swiper">
          <div class="swiperimg">
            <img :src="item.image_url" alt />
          </div>
          <p>{{ item.name }}</p>
          <h3>
            ￥{{ item.reduce_amount }}
            <span>无门槛</span>
          </h3>
        </div>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState(["wow_swiper"]),
  },
  async mounted() {
    let url = "http://localhost:8080/data/wow_swiper.json";
    let res = await this.$axios.get(url);
    this.$store.dispatch("swiper", res.data);
  },
};
</script>

<style lang="less" scoped>
#swiper {
  margin: 10px;
  .tequan {
    margin-left: 10px;
    h1 {
      font-size: 4.26667vw;
      font-weight: 700;
      color: #333;
      margin: 20px 0 20px 1.06667vw;
      display: flex;
      align-items: center;
      span {
        font-size: 3.2vw;
        height: 5.33333vw;
        line-height: 5.33333vw;
        text-align: center;
        color: rgba(64, 33, 10, 0.8);
        background-color: #f2d499;
        padding: 0.26667vw 1.06667vw;
        border-radius: 1.06667vw;
        vertical-align: text-bottom;
        margin-right: 1.6vw;
      }
    }
  }
  .my-swipe .van-swipe-item {
    width: 351px;
    height: 280px;
    color: #fff;
    text-align: center;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    box-sizing: border-box;
    padding: 10px;
    .swipertext {
      width: 100px;
      height: 120px;
      background-color: rgba(255, 230, 181, 0.2);
      .swiperimg {
        width: 58px;
        height: 58px;
        margin-top: 10px;
        img {
          width: 100%;
          height: 100%;
          margin-left: 20px;
        }
      }
      p {
        font-size: 2.933vw;
        line-height: 4.267vw;
        color: #666;
        white-space: nowrap;
        text-overflow: ellipsis;
        width: 18vw;
        overflow: hidden;
        margin-left: 20px;
        margin-top: 5px;
      }
      h3 {
        color: #ff4b33;
        font-size: 5vw;
        font-weight: 500;
        span {
          margin: 0 0 0 0.8vw;
          color: #b47738;
          font-size: 2.933vw;
          white-space: nowrap;
        }
      }
    }
  }
}
</style>